Skip to content

Conversation

@brian-oneill
Copy link

@brian-oneill brian-oneill commented Oct 29, 2025

This PR implements fixes, additions, and refactoring for the vertical coordinate module, including:

  • Moving EdgeMask from HorzMesh to VertCoord, and fixing initialization so EdgeMask properly accounts for bathymetry
  • This change removes the need for bootstrapping the VertCoord, initialization is consolidated into a single VertCoord::init() method
  • Replacing LOG_WARN messages with LOG_INFO during construction
  • Adding support for both new Omega names and old MPAS names when reading NVertLayers, MaxLayerCell, and MinLayerCell from mesh file
  • Adding optional arguments to VertCoord::init() to enhance flexibility in unit tests
  • Adding CellMask and VertexMask arrays for potential future use
  • Introducing new mask tests to the VertCoord unit test

Ctests were run successfully on Frontier CPU & GPU, pm-cpu, pm-gpu, and Chrysalis

Fixes #290

Checklist

  • Documentation:
    • Developer's Guide has been updated
    • Documentation has been built locally and changes look as expected
  • Building
    • CMake build does not produce any new warnings from changes in this PR
  • Testing
    • A comment in the PR documents testing used to verify the changes including any tests that are added/modified/impacted.
    • CTest unit tests for new features have been added per the approved design.
    • Unit tests have passed. Please provide a relevant CDash build entry for verification.

Copy link

@philipwjones philipwjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just had one minor suggestion below. Also verified it passes unit tests.

Copy link
Member

@mwarusz mwarusz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look mostly good. I left a couple of small comments.

However, I ran the test suite on pm-cpu with Kokkos bounds checking turned on and got many fails. They all look like this:

1: Kokkos::View ERROR: out of bounds access label=("VertexMask") with indices [1008,16] but extents [1169,16]

Specifically the following tests failed:

         13 - AUXVARS_PLANE_TEST (Failed)
         14 - AUXVARS_SPHERE_TEST (Failed)
         15 - AUXSTATE_TEST (Failed)
         20 - TEND_PLANE_TEST (Failed)
         21 - TEND_PLANE_SINGLE_PRECISION_TEST (Failed)
         22 - TEND_SPHERE_TEST (Failed)
         23 - TENDENCIES_TEST (Failed)
         27 - TIMESTEPPER_TEST (Failed)
         31 - TRACERS_TEST (Failed)
         34 - EOS_TEST (Failed)

I looked into the failures a little bit and I think they might be related to how the MaxLayerCell array is set in the case of prescribed NVertLayers. Because deepCopy is used, the value of MaxLayerCell(NCellsAll) is set to NVertLayers, but then never adjusted for 0-based indexing. I am not sure if this element should be set at all, or just be zero.

I have one more suggestion related to an issue I ran into when testing my hierarchical parallelism changes. I believe that currently when the MinLayerCell and MaxLayerCell arrays are read through iostreams they do not have their halo regions filled. So even thought the computations of the other Min/Max arrays and masks are done for all elements, they do not contain valid values everywhere. @brian-oneill Do you think it makes sense to fix this as part of this PR ?

AuxiliaryState(const std::string &Name, const HorzMesh *Mesh, Halo *MeshHalo,
int NVertLayers, int NTracers);
AuxiliaryState(const std::string &Name, const HorzMesh *Mesh,
const VertCoord *VCoord, Halo *MeshHalo, int NVertLayers,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that you passing in an instance of VertCoord you could remove the NVertLayers argument.

Comment on lines +9 to +10
const HorzMesh *Mesh, const VertCoord *VCoord,
const I4 NVertLayers, const I4 NTracers)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as in the AuxiliaryState, there is now no need to pass NVertLayers separately. This comment applies also to the other auxiliary vars that had similar changes.

Comment on lines +53 to +54
const bool ReadStream, //< [in] logical to read stream
const int InNVertLayers //< [in] int to set vertical dim
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it valid to have ReadStream = true and non-zero InVertLayers ? If not, can we check for this case and abort ?

ABORT_ERROR("VertCoord: Unknown MovementWeightType requested");
}

// Fetch reference desnity from Config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Fetch reference desnity from Config
// Fetch reference density from Config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

During testing, CTest reports warnings originating from VertCoord.cpp

3 participants